%funciones pseudo-trapezoidales de salida
%normalizados

ntrap = 7;
posB = zeros(ntrap,1);
posB(1) = [-1,-1,-0.8,-0.7];
posB(2) = [-0.8,-0.7,-0.4,-0.3];
posB(3) = [-0.4,-0.3,-0.1,0.0];
posB(4) = [-0.1,0.0,0.0,0.1];
posB(5) = [0,0.1,0.3,0.4];
posB(6) = [0.3,0.4,0.7,0.8];
posB(7) = [0.7,0.8,1,1];

tmin = -0.3;
tmax = 0;
step = 0.025;

npart = (tmax-tmin)/step;

B = zeros(ntrap,npart);
i = 1;
h = 1; %normalizo el set
for x=tmin:step:tmax
   for j=1:ntrap
       a = posB(j,1);
       b = posB(j,2);
       c = posB(j,3);
       d = posB(j,4);
       if(x>=a||x<b)
           B(i,j) = (x-a)/(b-a);
       else
           if(x>=b&&x<c)
               B(i,j) = h;
           else
               if(x>=c&&x<d)
                   B(i,j) =  (x-c)/(d-c);
               else
                   B(i,j) = 0;
               end
           end
       end
   end
   i = i+1;
end

